from django.contrib.syndication.feeds import Feed, FeedDoesNotExist

from ppcat.shell.models import Photo
from ppcat.shell.settings import PHOTO_NUM_PER_FEED

class LatestEntries(Feed):
	title = 'Titan Lab Photography Feed'
	link = 'http://ppcat.titanlab.net/shell/'
	description = 'Latest Entries Feed'
	item_enclosure_mime_type = 'image/jpeg'
	
	#def get_object(self, bits):
	#	return Photo.objects.order_by('-date_create')[:PHOTO_NUM_PER_FEED]
	
	def items(self):
		return [ p.caption for p in Photo.objects.order_by('-date_create')[:PHOTO_NUM_PER_FEED] ]

	def item_link(self):
		return self.link

	#def item_enclosure_url(self, item):
#		return item.get_image_thumbnail_url()